import request from '@/utils/request'
export function getRoles(data) {
  return request({
    url: '/sys/role',
    params: data
  })
}

export function removeRoles(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

export function addRole(data) {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

export function editRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}

export function getCompany() {
  return request({
    url: '/company'
  })
}

// 根据id获取角色详情
export function getRoleById(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

// 给角色分配权限
export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
